<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/commons/jsp/taglibs.jsp"%>
<%@taglib uri="http://www.framework.com/taglib" prefix="frame"%>
  <head>
	<title>公共平台 </title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<!-- 样式文件的引入 -->
	<link href="${ctx}/commons/css/style.css" rel="stylesheet" type="text/css"/>
	<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/icon.css">
	<!-- jqueryUI JS文件的引入 -->
	<script type="text/javascript" src="${ctx}/commons/js/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" src="${ctx}/commons/js/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="${ctx}/commons/js/easyui-extends-validate.js"></script>
	<!-- jqueryUI国际化 -->
	<script type="text/javascript" src="${ctx}/commons/js/easyui-lang-zh_CN.js"></script>
	<!-- 开发使用的公用js方法 -->
	<script type="text/javascript" src="${ctx}/commons/js/common.js"></script>
	<!-- 开发国际化的引用，主要完成后台信息在前台提示的国际化，一定要放在最后 -->
	<script type="text/javascript">var ctx = '${ctx}';var actionExt = "action";var i18n = new Object();</script>
	<script src="${ctx}/commons/js/i18n/message_zh_CN.js" type="text/javascript"></script>
  </head>
  
  <body>
    <div class="easyui-layout" data-options="fit:true,border:false" >
			<div data-options="region:'north',border:false" style="padding: 4px;height: 80px;overflow: hidden;">
			<div class="easyui-panel" data-options="fit:true,border:true" >
			<div  class="queryContent">
				<form name="searchProjectsForm" id="searchProjectsForm" method="post" action="" style="display: none; ">
				<table class="queryTable" >
					<tbody>
						<tr>
							<th >项目名称</th>
							<td width="10%">
								<input id="name" class="easyui-validatebox" type="text" name="name"  maxlength="50" style="width:120px;height: 15px;"/>
							</td>
							<th>项目编号</th>
							<td>
							 	<input id="code" class="easyui-validatebox" type="text" name="code"  maxlength="20" style="width:120px;height: 15px;"/>
							</td>
							<th >项目类型</th>
							<td width="10%">
								<select class="easyui-combobox" name="catagoryId" style="width:120px;;height: 25px;" data-options="">
									<option value="">--请选择--</option>
									<c:forEach items="${projectTypeList}" var="type">
										<option value="${type.id}">${type.name}</option>
									</c:forEach>
								</select>
							</td>
							<!-- 
								<th >资金来源</th>
							<td>
							 	<select id="moneySource" style="width:120px" class="easyui-combobox" name="moneySource">
							 		<option value="">--请选择--</option>
									<c:forEach items="${frame:dictChildren('moneySource')}" var="type">
										<option value="${type.value}">${type.name}</option>
									</c:forEach>
								</select>
							</td>
							 --> 
							<th  >状态</th>
							<td>
							 	<select id="status" style="width:120px;height: 25px;" class="easyui-combobox" name="status">
							 		<option value="">--请选择--</option>
									<c:forEach items="${frame:dictChildrenByRole('proj_status','manager')}" var="type">
										<option value="${type.value}">${type.name}</option>
									</c:forEach>
								</select>
							</td>
						</tr>
						<tr>
							<th>创建时间</th>
							<td>
								<input id="startTime" class="easyui-datebox" type="text" name="startTime"  data-options="validType:['dateTimeLessCompare[\'stopTime\']']" maxlength="20" style="width:120px;height: 25px;"/>-<input id="stopTime" class="easyui-datebox" type="text"  data-options="validType:['dateTimeMoreCompare[\'startTime\']']" name="stopTime" maxlength="20" style="width:120px;height: 25px;"/>
							</td>
							<th>开标时间</th>
							<td>
							 	<input id="startTime" class="easyui-datebox" type="text" name="bidTime"  data-options="validType:['dateTimeLessCompare[\'stopTime\']']" maxlength="20" style="width:120px;height: 25px;"/>-<input id="stopTime" class="easyui-datebox" type="text"  data-options="validType:['dateTimeMoreCompare[\'startTime\']']" name="bidStopTime" maxlength="20" style="width:120px;height: 25px;"/>
							</td>
							<!-- 
							<th>预算金额(元)</th>
							<td>
							 	<input id="startMoney" class="easyui-validatebox" type="text" name="startMoney"  data-options="validType:['rangeLessCompare[\'endMoney\']']" maxlength="20" style="width:120px"/>-<input id="endMoney" class="easyui-validatebox" type="text"  data-options="validType:['rangeMoreCompare[\'startMoney\']']" name="endMoney" maxlength="20" style="width:120px"/>
							</td>
							-->
							<th></th>
							<td align="right" colspan="3">
								<a href="javascript:void(0);" class="easyui-linkbutton" id="searchProjects" iconcls="icon-search" plain="true">查询</a>
								<a href="javascript:void(0);" class="easyui-linkbutton" id="resetsearchProjects" iconcls="icon-reset" plain="true">清空</a>
							</td>
						</tr>
					</tbody>
				</table>
				</form>
			</div>
			</div>
			</div>
			<div data-options="region:'center',border:false" style="padding: 4px;">
		    <table id="listProjectsTable" class="easyui-datagrid" 
				data-options="singleSelect:false,toolbar:'#goodstb',method:'post',rownumbers:true,fit:true,fitColumns:true,border:true,
					pagination:true,multiSort:true,remoteSort:true,striped:true,onLoadSuccess:function(data){$('#'+projectsParamObj.searchID).attr('disabled',false);},
					url:'${ctx}/business/projectmanage/list?roleId=manager'"}>
				<thead>
				   <tr>
						<th data-options="field:'name',width:170,title:'项目名称',sortable:true" align="center"></th>
						<th data-options="field:'code',width:90,title:'项目编号',sortable:true" align="center"></th>
						<th data-options="field:'catagoryName',width:80,title:'项目类型',sortable:true" align="center"></th>
						<th data-options="field:'buyName',width:120,title:'采购人',sortable:true" align="center"></th>
						<th data-options="field:'manageName',width:100,title:'项目负责人',sortable:true" align="center"></th>
						<th data-options="field:'createTime',width:100,title:'创建时间',sortable:true" align="center"></th>
						<th data-options="field:'bidStartTime',width:80,title:'开标时间 ',sortable:true" align="center"></th>
						<th data-options="field:'statusName',width:80,title:'状态',sortable:true" align="center"></th>
						<th data-options="field:'operation',width:160,title:'操作'" align="center"></th>
				   </tr>
				</thead>
			</table>
			<div id="goodstb" style="display: none;">
				<div>
					<a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-export" onclick="excelexport()"  plain="true">导出到Excel</a>
				</div>
			</div>
			<!----------------------- wei start --------------------->
			<!--导出Excel -->
			<input type="hidden" id="excel_error" value="${requestScope.excel_error }"/>
			<script type="text/javascript">
		    	//导出
				function excelexport(){
					$("form").attr("action","${ctx}/business/projectmanage/export")
					$("form").submit();

					var val=$("#excel_error").val();
					if(val!=""){//不为空提示错误消息
						 $.messager.alert("操作提示", val,"error");  
					}
				}
				
		    </script>
			<!----------------------- wei end --------------------->		
		</div>
	</div>
	<div id="bindPicDialog"></div>
	<div id="selPicDialog"></div>
	<div id="noCompetReasonDialog"></div>
	<div id="projectPause"></div>    
</body>
	<script type="text/javascript">
		//初始化表格对应的js对象
		var projectsParamObj;
		$(function() {
			//初始化表格对象数据
			projectsParamObj = new initParams(
					{
						paramObjName : 'projectsParamObj',//表格对应的实体对象名称，好区分多个表格情况下的对象
						tableId:'listProjectsTable',
						addDataFormId:'addProjectsDataForm',
						showDialogId:'firstLevelDialog',
						searchID:'searchProjects',
						resetSearchID:'resetsearchProjects',
						searchFormID:'searchProjectsForm',
						updateUrl:"${ctx}/business/projectmanage/input?projectId=",
						deleteUrl:'${ctx}/business/projectmanage/remove',
						addDialogWidth:700,
						addDialogHeight:520,
						ctx:'${ctx}',
						addDialogTitle:'采购项目信息'
					});
			//初始化查询
			init(projectsParamObj);
			//setTimeout(function(){
				//$.parser.parse(".optionsAreas");
			//},1000);
		});
		
		/**
		 * 操作按钮处理
		 * @param {Object} value
		 * @param {Object} row
		 * @param {Object} index
		 */
		function getOptionsBtn(value, row, index){
			var btnsHtml = "<span class='optionBtnsArea'>";
			var doSubmitHtml = '<a href="javascript:void(0)" onclick="doSubmit(\'' + row.id + '\')" class="">提交</a>&nbsp;';
			var toUpdateHtml = '<a href="javascript:void(0)" onclick="openDataDialog(projectsParamObj,\'' + row.id + '\')" class="">修改</a>&nbsp;';
			var callBackHtml = '<a href="javascript:void(0)" onclick="doCallback(\'' + row.id + '\')" class="">撤回</a>&nbsp;';
			var infoViewHtml = '<a href="javascript:void(0)" onclick="getProjectDetail(\'' + row.id + '\')" class="">项目详情</a>&nbsp;';
			var cancelHtml = '<a href="javascript:void(0)" onclick="doCancel(\'' + row.id + '\')" class="">撤销</a>&nbsp;';
			var noticBidInfoHtml = '<a href="javascript:void(0)" onclick="noticBidInfo(\'' + row.id + '\')" class="">发放中标通知书</a>&nbsp;';
			var contractPassHtml = '<a href="javascript:void(0)" onclick="contractAudit(\'' + row.id + '\',1)" class="">通过</a>&nbsp;';
			var contractNoPassHtmlHtml = '<a href="javascript:void(0)" onclick="contractAudit(\'' + row.id + '\',0)" class="">不通过</a>&nbsp;';
			
			
			
			return btnsHtml +"</span>";
		}


		 /**
		 *提交
		 **/
		 function doSubmit(id){
			 top.$.messager.confirm('提示',"您确认要提交吗？",function(result){
				 if(result){
					 $.ajax({
							type: "post",
							url:  "${ctx}/business/projectmanage/doSubmit?id="+id,
							data:top.$("#addProjectsDataForm").serialize(),
							success: function(data,res){
								var result = $.trim(res.responseText);
								if(result == "unLogin"){
									var msn = ''||i18n[''];
									msn = msn||i18n[result];
									if(msn != undefined){
										top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
										return ;
									}
								}
								top.$.messager.alert("提示",'提交成功','info',function(){
									$('#listProjectsTable').datagrid('reload');
								});
								
							},
							error: function(res){
								$.messager.alert('提示',i18n.requestError,'error');
							}
						});
				 }
			 });
			 return ;
		 }
		 
		 /**
		 * 打开添加数据的页面的对话框(添加，修改)
		 * @param {Object} paramObj ： 对应的列表对象
		 * @param {Object} id ： 数据记录的ID
		 * @param {Object} successcallback ：添加数据成功后的回调函数
		 * @param {Object} failurecallback ： 添加数据失败后的回调函数  
		 */
		function openDataDialog(paramObj,id,successcallback,failurecallback){
			if(id == undefined){
				id='';
			}
			var sign = false;
			top.$('#'+paramObj.showDialogId).dialog({    
			    title:paramObj.addDialogTitle,   
			    iconCls:'icon-view',
			    width: paramObj.addDialogWidth,    
			    height: paramObj.addDialogHeight,    
			    closed: false,    
			    inline : true,
			    cache: false,    
			    href: paramObj.updateUrl+id,    
			    modal: true,
				extractor : function(data){
					if($.trim(data) == "unLogin"){
						var msn = ''||i18n[''];
						msn = msn||i18n[data];
						if(msn != undefined){
							top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
							return '';
						}
					}
					return data;
				},
			    buttons : [{text:'保存',
			    		id:'addEntityBt',
						iconCls:'icon-save',
						handler:function(){
							top.$('#addEntityBt').linkbutton('disable');
							return;
						    saveEntity(paramObj,'addEntityBt',0);
						}
					},{text:'提交',
			    		id:'commitEntityBt',
						iconCls:'icon-ok',
						handler:function(){
							top.$('#commitEntityBt').linkbutton('disable');
							return;
			    			submitEntity(paramObj,'saveEntityBt',1);
						}//增加保存按钮
					},{
						text:paramObj.cancelButton,//取消
						iconCls:'icon-cancel',
						handler:function(){
							top.$('#'+paramObj.showDialogId).dialog('close');
						}}],
				onClose : function(){// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
					top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
					top.$("#dealDeclareUpload").uploadify('destroy');//销毁文件上传对象....
					top.$("#proDemandUpload").uploadify('destroy');//销毁文件上传对象....
					top.$("#otherUpload").uploadify('destroy');//销毁文件上传对象....
					if(top.$('#'+paramObj.showDialogId).find("object").length > 0){
						var fileQueue = top.window.document.getElementById("fileQueue");
						fileQueue.innerHTML = "";
						fileQueue.parentNode.removeChild(fileQueue);
					}
					afterClosed();
				}
			});
			top.$('#'+paramObj.showDialogId).dialog("center");
		}
		
		/**
		 *保存按钮操作
		 **/
		function saveEntity(paramObj,opBtId,commitType){
			//alert("保存操作");
			//var noteText=top.$('.noteText').val();
			//前注文本
			var noteText="";
			top.$('.noteText').each(function(){
				noteText+=top.$(this).val()+"@";
			});
			top.$("#noteText").val(noteText);

			//响应文件
			var responseFile="";
			top.$('.responseFile').each(function(){
				var val=$.trim(top.$(this).val());
				if(val==""){
					val="-";
				}
				responseFile+=val+"@";
			});
			top.$("#responseFile").val(responseFile);
			//alert(responseFile);
			//return;
			//保存项目
			$.ajax({
				type : "post",
				url : "${ctx}/business/projectmanage/leader/establishSave?r="+new Date().getTime(),
				data : top.$("#addProjectsDataForm").serialize(),
				dataType : "text",
				success : function(data){
					var result=eval("("+data+")");
					//if(data=="success"){
						//top.$(".upload").uploadify('destroy');//销毁文件上传对象....
							top.$.messager.alert("提示",'保存成功','info',function(){
								$('#listProjectsTable').datagrid('reload');
								top.$('#firstLevelDialog').dialog('close');
							});
					
				},
				error : function(data){
					alert("错误");
				}
			});
		}

		/**
		*提交按钮操作
		*/
		function submitEntity(paramObj,opBtId,commitType){
			//alert("提交按钮操作");
			//前注文本
			var noteText="";
			top.$('.noteText').each(function(){
				noteText+=top.$(this).val()+"@";
			});
			top.$("#noteText").val(noteText);

			//响应文件
			var responseFile="";
			top.$('.responseFile').each(function(){
				var val=$.trim(top.$(this).val());
				if(val==""){
					val="-";
				}
				responseFile+=val+"@";
			});
			top.$("#responseFile").val(responseFile);
			
				loadinginfo();//显示加载框
			if(top.$('#addProjectsDataForm').form('validate')){//表单校验是否通过
				//alert("提交按钮操作");
				$.ajax({
					type : "post",
					url : "${ctx}/business/projectmanage/leader/doSubmitCompile?r="+new Date().getTime(),
					data : top.$("#addProjectsDataForm").serialize(),
					success : function(data){
						top.$('#secondtLevelDialog').dialog('close');//隐藏加载框
						if(data=="success"){
							//top.$(".upload").uploadify('destroy');//销毁文件上传对象....
								top.$.messager.alert("提示",'提交成功','info',function(){
									$('#listProjectsTable').datagrid('reload');
									top.$('#firstLevelDialog').dialog('close');
								});
						}else if(data=="existtwoproject"){
							top.$.messager.alert("提示",'提交失败，当前时间已有两个项目了!',"error");
						}
						else{
							top.$.messager.alert("提示",'提交失败!',"error");
						}
					},
				error : function(data){
						top.$('#secondtLevelDialog').dialog('close');//隐藏加载框
						top.$.messager.alert("提示",'提交失败!',"error");
				}
				});
			}else{//表单校验不通过
				top.$('#secondtLevelDialog').dialog('close');//隐藏加载框
				top.$.messager.alert('提示',"请将信息填写完整或检查信息填写是否正确后再点击提交!",'error',function(){});
			}
		}

		
		/**
		*项目详情
		*/
		function getProjectDetail(id){
			top.$('#firstLevelDialog').dialog({    
			    title:"项目详情",  
			    iconCls:'icon-view',
			    width: 1000,    
			    height: 580,    
			    closed: false,    
			    inline : true,
			    cache: false,    
			    href: "${ctx}/business/projectmanage/getProjectDetail?projectId=" + id+"&roleId=manager",
			    modal: true,
				extractor : function(data){
					if($.trim(data) == "unLogin"){
						var msn = ''||i18n[''];
						msn = msn||i18n[data];
						if(msn != undefined){
							top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
							return '';
						}
					}
					return data;
				},
			    buttons : [{
						text:projectsParamObj.cancelButton,
						iconCls:'icon-cancel',
						handler:function(){
							top.$('#firstLevelDialog').dialog('close');
						}}]
			});
			top.$('#'+projectsParamObj.showDialogId).dialog("center");
		}


		//关闭
		function afterClosed(){
			
			// 在弹出对话框内找到Uploadify插件，并隐藏之。
             top.$.find('.upload').hide();
			// 将弹出对话框还原成弹出前的状态，并清空里面的内容。
			top.$('#firstLevelDialog').dialog('destroy').empty();

			}
	
	 	/**
		 * 打开编制的页面的对话框(添加，修改)
		 * @param {Object} paramObj ： 对应的列表对象
		 * @param {Object} id ： 数据记录的ID
		 * @param {Object} successcallback ：添加数据成功后的回调函数
		 * @param {Object} failurecallback ： 添加数据失败后的回调函数  
		 */
		function doEstablish(id){
			top.$('#firstLevelDialog').dialog({
						 			title:"项目编制",  
								    iconCls:'icon-view',
								    width: '1000',    
								    height: '600',    
								    closed: false,    
								    inline : true,
								    cache: false,    
								    href: "${ctx}/business/projectmanage/leader/establishInput?projectId="+id,   
								    modal: true,
									extractor : function(data){
										if($.trim(data) == "unLogin"){
											var msn = ''||i18n[''];
											msn = msn||i18n[data];
											if(msn != undefined){
												top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
												return '';
											}
										}
										return data;
									},
								    buttons : [{text:'提交',
								            id:'commitEntityBt',
											iconCls:'icon-ok',
											handler:function(){
													if(top.$('#addProjectsDataForm').form('validate')){
														top.$('#commitEntityBt').linkbutton('disable');
													}
													submitEntity('saveEntityBt',1);
												}

											}
										,{text:'保存',
										    id:'addEntityBt',
											iconCls:'icon-ok',
											handler:function(){
												top.$('#addEntityBt').linkbutton('disable');
												if(top.$('#addApproveResonForm').form('validate')){
													 saveEntity('addEntityBt',0);
												}
												}

											}
										,{
											text:'取消',
											iconCls:'icon-cancel',
											handler:function(){
												top.$('#firstLevelDialog').dialog('close');
											}}],
											onClose : function(){// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
												//alert(2);
												top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
												afterClosed();
											}
									});
						 top.$('#firstLevelDialog').dialog("center");
		}	 


		 /**
		 * 发放中标通知书
		 */
		 function noticBidInfo(id){
			 top.$.messager.confirm('提示',"您确认要发放本项目中标通知书、项目合同吗？",function(result){
				 if(result){
					 $.ajax({
							type: "post",
							url:  "${ctx}/business/projectmanage/leader/noticBidInfo?id="+id,
							success: function(data,res){
								var result = $.trim(res.responseText);
								if(result == "unLogin"){
									var msn = ''||i18n[''];
									msn = msn||i18n[result];
									if(msn != undefined){
										top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
										return ;
									}
								}
								top.$.messager.alert("提示",'请于5个工作日内退还非中标人投标保证金!','info',function(){
									$('#listProjectsTable').datagrid('reload');
								});
								
							},
							error: function(res){
								$.messager.alert('提示',i18n.requestError,'error');
							}
						});
				 }
			 });
		 }


			 /**
			 * 合同审核操作
			 */
			 function contractAudit(id,type){
				 $('#bindPicDialog').dialog({
						title: '审核意见',
						width: 450,
						height: 200,
						closed: false,
						inline : true,
						modal: true,
						cache: false,
						content: '<table class="infoTable"><tbody><tr><th align="right" width="15%">填写原因</th><td  width="36%"><textarea id="reason"  name="reason" style="width:350px;height:80px;" rows="6" type="text" maxlength="200" value=""></textarea></td></tr></tbody></table>',
						buttons :
								[{text:'提交',
									iconCls:'icon-ok',
									handler:function(){
										var reason=$("#reason").val();
										if(type=="0"){//通过
											if(reason==""||reason==undefined){ 
												top.$.messager.alert("提示",'请输入理由!','info',function(){
												});
												return;
											}
										}
										$.ajax({
											type: "post",
											url:  "${ctx}/business/projectmanage/leader/contractAudit",
											data:{"projectId":id,"reason":reason,"type":type},
											success: function(data,res){
												var result = $.trim(res.responseText);
												if(result == "unLogin"){
													var msn = ''||i18n[''];
													msn = msn||i18n[result];
													if(msn != undefined){
														top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
														return ;
													}
												}
												top.$.messager.alert("提示",'操作成功!','info',function(){
													$('#listProjectsTable').datagrid('reload');
												});
												
											},
											error: function(res){
												$.messager.alert('提示',i18n.requestError,'error');
											}
										});
										$('#bindPicDialog').dialog('close');
									}
								},{
									text:'取消',
									iconCls:'icon-cancel',
									handler:function(){
										$('#bindPicDialog').dialog('close');
									}}]
				});
				 $('#bindPicDialog').dialog("center");
				 
			 }
			 
			 /**
			 * 结项操作
			 */
			 function endProject(id){
				 $.messager.confirm('提示',"您确定要结束项目吗？",function(result){
					 if(result){
						 $.ajax({
								type: "post",
								url:  "${ctx}/business/projectmanage/leader/endProject?projectId="+id,
								success: function(data,res){
									var result = $.trim(res.responseText);
									if(result == "unLogin"){
										var msn = ''||i18n[''];
										msn = msn||i18n[result];
										if(msn != undefined){
											top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
											return ;
										}
									}
									top.$.messager.alert("提示",'操作成功!','info',function(){
										$('#listProjectsTable').datagrid('reload');
									});
									
								},
								error: function(res){
									$.messager.alert('提示',i18n.requestError,'error');
								}
							});
					 }
				 });
			 }
			 
			 /*录入专家信息*/
			 
			 function professorInput(id){   
			    top.$('#firstLevelDialog').dialog({
				 			title:"专家信息",  
						    iconCls:'icon-view',
						    width: '1015',    
						    height:'425',    
						    closed: false,    
						    inline : true,
						    cache: false,    
						    href: "${ctx}/business/professor/toProfessorListPage?projectId="+id,
						    modal: true,
						    close: afterClosed,
							extractor : function(data){
								if($.trim(data) == "unLogin"){
									var msn = ''||i18n[''];
									msn = msn||i18n[data];
									if(msn != undefined){
										top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
										return '';
									}
								}
								return data;
							   },
							   buttons : [
							        {text:'结束专家资料录入',
									iconCls:'icon-ok',
									handler:function(){	
										$.ajax({
										type:"post",
										url:"${ctx}/business/professor/completeTask?projectId="+id,
										success:function(){
											top.$.messager.alert("提示信息",'保存成功！','info',function(){
												 $('#listProjectsTable').datagrid('reload');
												 top.$('#firstLevelDialog').dialog('close');
												});
											
										}		
										});
									}
									
									}
								,
								{
									text:'取消',
									iconCls:'icon-cancel',
									handler:function(){
										top.$('#firstLevelDialog').dialog('close');
								}}],
			    
							});
			    
			 }
			 
			 
			 /*暂停流程*/
			 
			 function projectPause(id,category){   
			    top.$('#firstLevelDialog').dialog({
				 			title:"暂停流程",  
						    iconCls:'icon-view',
						    width: '865',    
						    height:'325',    
						    closed: false,    
						    inline : true,
						    cache: false,    
			               href: "${ctx}/business/projectPause/leader/prjectPauserPage?projectId="+id+"&category="+category,
						    modal: true,
						    close: afterClosed,
							extractor : function(data){
								if($.trim(data) == "unLogin"){
									var msn = ''||i18n[''];
									msn = msn||i18n[data];
									if(msn != undefined){
										top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
										return '';
									}
								}
								return data;
							   },
							   buttons : [
							        {text:'提交申请',
									iconCls:'icon-ok',
									handler:function(){	
										top.$('#myform').form('submit', {    
										    url:"${ctx}/business/projectPause/leader/saveProjectPause?resultString=0",
										    onSubmit: function(){ 											    										
										    if (!$('#myform').form('validate')) {
										    	top.$.messager.alert('提示信息','验证没有通过,不能提交表单!','info');
												return false; //当表单验证不通过的时候 必须要return false 
											   }
										    },   
										    success:function(data){
										       if(data=="saveSuccess"){	
										    top.$.messager.alert('提示信息','提交成功!','info',function(){
										    	 top.$('#firstLevelDialog').dialog('close');
										    	$('#listProjectsTable').datagrid('reload');
										    	});									
										       $('#listProjectsTable').datagrid('reload');
												}else if(data=="reasonnull"){
												 top.$.messager.alert('提示信息','原因不为空!','info');
												}
										     
										    } 
										   
		                              });  
										}
									}
								,
								{
									text:'取消',
									iconCls:'icon-cancel',
									handler:function(){
										top.$('#firstLevelDialog').dialog('close');
								}}
								
								],
								onClose : function(){// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
									top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
									top.$("#dealDeclareUpload").uploadify('destroy');//销毁文件上传对象....
									afterClosed();
								}
							});
				 		top.$('#firstLevelDialog').dialog("center");
			       
			    
			 }
			 
			 


			 /**
				 * 打开评标窗体
				 */
				 function evaluateBid(id){
						 		top.$('#firstLevelDialog').dialog({
						 			title:"评标操作",  
								    iconCls:'icon-view',
								    width: '800',    
								    height: '500',    
								    closed: false,    
								    inline : true,
								    cache: false,    
								    href: "${ctx}/business/projectmanage/leader/evaluateInput?projectId="+id,   
								    modal: true,
								    close: afterClosed,
									extractor : function(data){
										if($.trim(data) == "unLogin"){
											var msn = ''||i18n[''];
											msn = msn||i18n[data];
											if(msn != undefined){
												top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
												return '';
											}
										}
										return data;
									},
								    buttons : [{
											text:'取消',
											iconCls:'icon-cancel',
											handler:function(){
												top.$('#firstLevelDialog').dialog('close');
											}}],
											onClose : function(){// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
												//alert(2);
												top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
												afterClosed();
											}
									});
						 		top.$('#firstLevelDialog').dialog("center");
				}
		//===============================================================
		/*
		*评标初审结束
		**/
		function firstEvaluateBidEnd(id){
			 $.messager.confirm('提示',"您确定要初审结束吗？",function(result){
				 if(result){
					 $.ajax({
							type: "post",
							url:  "${ctx}/business/projectmanage/leader/firstEvaluateBidEnd?projectId="+id,
							success: function(data,res){
								var result = $.trim(res.responseText);
								if(result == "unLogin"){
									var msn = ''||i18n[''];
									msn = msn||i18n[result];
									if(msn != undefined){
										top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
										return ;
									}
								}
								if(data == "evaluationcountnocomplete"){
									$.messager.alert('提示',"有效标不足三家，且有未评标！",'error');
								}else{
									top.$.messager.alert("提示",'操作成功!','info',function(){
										$('#listProjectsTable').datagrid('reload');
									});
								}
								
							},
							error: function(res){
								$.messager.alert('提示',i18n.requestError,'error');
							}
						});
				 }
			 });
		}
		
		/**
		* 评标结束
		*/
		function evaluationBidEnd(id){
			top.$('#firstLevelDialog').dialog({
	 			title:"结束评标操作",  
			    iconCls:'icon-view',
			    width: '800',    
			    height: '500',    
			    closed: false,    
			    inline : true,
			    cache: false,    
			    href: "${ctx}/business/projectmanage/leader/evaluationBidEndInput?projectId="+id,   
			    modal: true,
			    close: afterClosed,
				extractor : function(data){
					if($.trim(data) == "unLogin"){
						var msn = ''||i18n[''];
						msn = msn||i18n[data];
						if(msn != undefined){
							top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
							return '';
						}
					}
					return data;
				},
			    buttons : [{
						text:'评标结束并提交',
						iconCls:'icon-ok',
						handler:function(){
							if(top.$('#addDataForm').form('validate')){//表单校验是否通过
								//alert("提交按钮操作");
								$.ajax({
									type : "post",
									url : "${ctx}/business/projectmanage/leader/evaluationBidEnd?r="+new Date().getTime(),
									data : top.$("#addDataForm").serialize(),
									success : function(data){
										if(data=="success"){
											//top.$(".upload").uploadify('destroy');//销毁文件上传对象....
												top.$.messager.alert("提示",'提交成功','info',function(){
													$('#listProjectsTable').datagrid('reload');
													top.$('#firstLevelDialog').dialog('close');
												});
										}
										else{
											top.$.messager.alert("提示",'提交失败!',"error");
										}
									},
								error : function(data){
										top.$.messager.alert("提示",'提交失败!',"error");
								}
								});
							}
							
						}},
						{
							text:'取消',
							iconCls:'icon-cancel',
							handler:function(){
								top.$('#firstLevelDialog').dialog('close');
							}}],
						onClose : function(){// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
							top.$(".uploadify").each(function() {
								var uploadId=$(this).parent().parent().find(".uploadify").attr("id");
								top.$("#"+uploadId).uploadify('destroy');//销毁文件上传对象....
							});
							afterClosed();
						}
				});
	 		top.$('#firstLevelDialog').dialog("center");
		}
		
		$(function(){
			var resIds = "";
			<c:forEach items="${resList}" var="res">
			resIds += ",${res.id}";
			</c:forEach>
			$('#budgetMenuData').val(resIds);



			$(".uploadify").each(function() {
				upload=$(this).parent().parent().parent().find(".fileName");
				fileQueue=$(this).parent().parent().parent().find(".fileQueue");
				//alert(upload.val());
				$(this).uploadify({
					'height'        : 27,   
		            'width'         : 80,    
		            'buttonText'    : '选择附件',
		            'queueID': fileQueue.val(),//队列的ID
		            'queueSizeLimit':5,// 附件附列长度
					'swf': '${ctx}/commons/js/uploadify/uploadify.swf',
					'uploader':'${ctx}/business/projectmanage/upload;jsessionid=${pageContext.session.id}',// 上传时请求的后台处理的controller
					'cancelImg': '${ctx}/commons/js/uploadify/uploadify-cancel.png',
					'method':'post',  
					'folder': '',
					'preventCaching' : true,
					'fileTypeExts' :'*.jpg;*.png;*.gif;*.bmp;*.pdf',
					'auto': true,
					'multi': true,//是否可多选
					'removeCompleted' : false,
					'successTimeout' : 55555,
					'onUploadSuccess':function(file, data, response){
						$('#' + file.id).find('.data').html(' 上传完毕');
						$('#budgetMenuData').val($('#budgetMenuData').val() + "," + data);
						//alert("ww"+$('#' + file.id).parent().html());
						var cancel=$('#fileQueue .uploadify-queue-item[id="' + file.id + '"]').find(".cancel a");
						if (cancel) {
						   cancel.attr("rel", data);
						   cancel.click(function () {
							   var cancelData = cancel.attr("rel");
				               var  budgetMenuData = $('#budgetMenuData').val();
				               var index = budgetMenuData.indexOf(","+cancel.attr("rel"))
				               if(index != -1){
				            	   budgetMenuData = budgetMenuData.replace(","+cancelData,"");
				            	   $('#budgetMenuData').val(budgetMenuData);
				               }
						   });
						}
					},
					'onUploadStart':function(file){
						//alert("ww"+$('#' + file.id).parent().parent().find(".uploadify").attr("id"));
						var uploadId=$('#' + file.id).parent().parent().find(".uploadify").attr("id");
						//var params=$('#' + file.id).parent().parent().parent().parent().find(".fileName").val();
						var functionFlog=$('#' + file.id).parent().parent().parent().parent().find(".fileQueue").attr("flag");
				        $("#"+uploadId).uploadify("settings","formData",{"functionFlog":functionFlog});
					},
					'onSelectError':function(file, errorCode, errorMsg){
						//alert(errorCode);
						switch(errorCode) {
							case -110:
								//this.queueData.errorMsg="文件 ["+file.name+"] 大小超出系统限制的"+$('#file_upload').uploadify('settings','fileSizeLimit')+"大小！";
								this.queueData.errorMsg='所选文件大小超出系统限制!';
								break;
							case -120:
								//this.queueData.errorMsg="文件 ["+file.name+"] 大小异常！"
								this.queueData.errorMsg='所选文件大小异常!';
								break;
							case -130:
								//this.queueData.errorMsg="文件 ["+file.name+"] 类型不正确！"
								this.queueData.errorMsg='所选文件类型不正确!';
								break;
						}
					},
					'onCancel' : function(file){
						alert(file);
					}
				});
			});
			
		});
		
		/*评标纪要*/
		function reviewRecord(id){	
			 window.open("${ctx}/business/projectmanage/print/reviewRecord?projectId="+id);
		}
		
		/*评监督员签到表*/
		function signIn(id){	
			 window.open("${ctx}/business/projectmanage/print/signIn?projectId="+id);
		}
		
		/*专家监督人员劳务费支出表范本*/
		function serviceCharge(id){	
			 window.open("${ctx}/business/projectmanage/print/serviceCharge?projectId="+id);
		}
		
		/*合肥市包河区政府采购中心投标文件签收登记表*/
		function projectBid(id){	
			 window.open("${ctx}/business/projectmanage/print/projectBid?projectId="+id);
		}
		
		/*竞标单位竞价记录表*/
		function quote(id){	
			 window.open("${ctx}/business/projectmanage/print/quote?projectId="+id);
		}
		
		
		/**
		 * 打开归档资料选择页面
		 */
		 function pigeonhole(id){//
			 top.$('#firstLevelDialog').dialog({
		 			title:"归档操作",  
				    iconCls:'icon-view',
				    width: '665',    
				    height:'525',    
				    closed: false,    
				    inline : true,
				    cache: false,    
				    href:  "${ctx}/business/projectmanage/leader/pigeonholeInput?projectId="+id,
				    modal: true,
				    close: afterClosed,
					extractor : function(data){
						if($.trim(data) == "unLogin"){
							var msn = ''||i18n[''];
							msn = msn||i18n[data];
							if(msn != undefined){
								top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
								return '';
							}
						}
						return data;
					   },
					   buttons : [
					        {text:'一键导出',
							iconCls:'icon-ok',
							handler:function(){	
								/*$.ajax({
									type:"post",
									url:"${ctx}/business/projectmanage/leader/exportAllFile",
									data:top.$("#pigeonholeForm").serialize(),
									success:function(data){
										top.$('#firstLevelDialog').dialog('close');
									}
								});*/
								top.$("#pigeonholeForm").submit();
								top.$('#firstLevelDialog').dialog('close');
								
							}
							
							}
						,
						{
							text:'取消',
							iconCls:'icon-cancel',
							handler:function(){
								top.$('#firstLevelDialog').dialog('close');
						}}],
	    
					});
		 		top.$('#firstLevelDialog').dialog("center");
		 }
		
		/*评审表*/
		function review(id){	
			window.open("${ctx}/business/projectmanage/print/reviewPage?projectId="+id);
			   
			    
		}
		
		//保证金处理
		 function returnDeposit(id){   
			    top.$('#threeLevelDialog').dialog({
				 			title:"保证金",  
						    iconCls:'icon-view',
						    width: '1000',
						    height:'500',
						    closed: false,    
						    inline : true,
						    cache: false,    
						    href: "${ctx}/business/projectmanage/leader/returnDepositPage?projectId="+id,
						    modal: true,
						    close: afterClosed,
							extractor : function(data){
								if($.trim(data) == "unLogin"){
									var msn = ''||i18n[''];
									msn = msn||i18n[data];
									if(msn != undefined){
										top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
										return '';
									}
								}
								return data;
							   }, 
							   onClose:function(){
								   $('#listProjectsTable').datagrid('reload');
							    }
						    
							});
				 		top.$('#threeLevelDialog').dialog("center");       
			 }
		
		   //保证金明细
		 function returnDepositDetail(id){   
			    top.$('#threeLevelDialog').dialog({
				 			title:"保证金",  
						    iconCls:'icon-view',
						    width: '1000',
						    height:'500',
						    closed: false,    
						    inline : true,
						    cache: false,    
						    href: "${ctx}/business/projectmanage/leader/returnDepositDetailPage?projectId="+id,
						    modal: true,
						    close: afterClosed,
							extractor : function(data){
								if($.trim(data) == "unLogin"){
									var msn = ''||i18n[''];
									msn = msn||i18n[data];
									if(msn != undefined){
										top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
										return '';
									}
								}
								return data;
							   }, 
							   onClose:function(){
								   $('#listProjectsTable').datagrid('reload');
							    }
						    
							});
				 		top.$('#threeLevelDialog').dialog("center");       
			 }

		/**
		*质疑投诉
		***/
		 function oppugn(id){
			 top.$('#firstLevelDialog').dialog({
		 			title:"质疑投诉",  
				    iconCls:'icon-view',
				    width: '900',    
				    height:'500',    
				    closed: false,    
				    inline : true,
				    cache: false,    
				    href: "${ctx}/business/projectmanage/leader/oppugnInput?id="+id,
				    modal: true,
				    close: afterClosed,
					extractor : function(data){
						if($.trim(data) == "unLogin"){
							var msn = ''||i18n[''];
							msn = msn||i18n[data];
							if(msn != undefined){
								top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
								return '';
							}
						}
						return data;
					},
					buttons :
						[{text:'提交',
							iconCls:'icon-ok',
							handler:function(){
								var contentMsg=top.getEditorHTMLContents();
								if(contentMsg==''){
									top.$.messager.alert('提示',"请输入内容",'error');
									return false;
								}
								if(top.$('#addContentDataForm').form('validate')){//表单校验是否通过
									//获取富文本中的文字									
									top.$('#contentMsg').val(top.getEditorHTMLContents());
									$.ajax({
										type: "post",
										url:  "${ctx}/business/webcontent/save",
										data:top.$('#addContentDataForm').serialize(),
										success: function(data,res){
											var result = $.trim(res.responseText);
											if(result == "unLogin"){
												var msn = ''||i18n[''];
												msn = msn||i18n[result];
												if(msn != undefined){
													top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
													return ;
												}
											}
											top.$.messager.alert("提示",'操作成功!','info',function(){
												$('#listProjectsTable').datagrid('reload');
											});
											
										},
										error: function(res){
											$.messager.alert('提示',i18n.requestError,'error');
										}
									});
									top.$('#firstLevelDialog').dialog('close');
								}
							}
						},{
							text:'取消',
							iconCls:'icon-cancel',
							handler:function(){
								top.$('#firstLevelDialog').dialog('close');
							}}],
							onClose : function(){// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
								top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
								afterClosed();
							}
			});
		 		top.$('#firstLevelDialog').dialog("center");
		 }
		
		
		//验收审核
		 function receivingAudit(id){   
			    top.$('#firstLevelDialog').dialog({
				 			title:"验收审核",  
						    iconCls:'icon-view',
						    width: '865',    
						    height:'300',    
						    closed: false,    
						    inline : true,
						    cache: false,    
						    href: "${ctx}/business/projectmanage/leader/receivingAuditPage?projectId="+id,
						    modal: true,
						    close: afterClosed,
							extractor : function(data){
								if($.trim(data) == "unLogin"){
									var msn = ''||i18n[''];
									msn = msn||i18n[data];
									if(msn != undefined){
										top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
										return '';
									}
								}
								return data;
							   },
							   buttons : [
							        {text:'提交',
									iconCls:'icon-ok',
									handler:function(){	
										$.ajax({
										type:"post",
										url:"${ctx}/business/projectmanage/leader/receivingAudit",
										data:top.$("#myform").serialize(),		
										success:function(data){
										if(data=="reasonnull"){
											top.$.messager.alert('提示信息','原因不为空！');
											
										}else if(data=="saveSuccess"){
											top.$.messager.alert('提示信息','保存成功','info',function(){
												 $('#listProjectsTable').datagrid('reload');													
												 top.$('#firstLevelDialog').dialog('close');
												});	
										}
										
										}		
										});
										
									}
									}
								,
								{
									text:'取消',
									iconCls:'icon-cancel',
									handler:function(){
										top.$('#firstLevelDialog').dialog('close');
								}}],
			    
							});
				 		top.$('#firstLevelDialog').dialog("center");
			 }
			 
		
		//解锁合同
		 function unlock(id){   
			 $.messager.confirm('确认对话框', '解除锁定？', function(r){
					if (r){
						  $.ajax({
						    	type:'post',
						    	url:'${ctx}/business/projectmanage/leader/unlockContract',
						    	data:{projectId:id},
						    	success:function (data){
						    		if(data=="saveSuccess"){
						    			top.$.messager.alert('提示信息','解锁成功！','info');
						    			/*  $.messager.show({
										        title:"提示信息",
										        msg:"解锁成功！"				        
										     });*/
						    			}else if(data==""){
						    			top.$.messager.alert('提示信息','解锁失败！','info');
							    				/*$.messager.show({
											        title:"提示信息",
											        msg:"解锁失败！"				        
											     });*/
						    				}
						    			
						    		}
						    	 
						    	});
						  $('#listProjectsTable').datagrid('reload');
					}
				});
			 }

			
			//项目撤销
		 function projectRevoke(id,category){ 
			    $('#projectPause').dialog({
				 			title:"项目撤销",  
						    iconCls:'icon-view',
						    width: '600',    
						    height:'225',    
						    closed: false,    
						    inline : true,
						    cache: false,    
					        href: "${ctx}/business/projectPause/bizmanager/projectRevokePage?projectId="+id,
						    modal: true,
							extractor : function(data){
								if($.trim(data) == "unLogin"){
									var msn = ''||i18n[''];
									msn = msn||i18n[data];
									if(msn != undefined){
										top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
										return '';
									}
								}
								return data;
							   },
							   buttons : [
							        {text:'提交',
									iconCls:'icon-ok',
									handler:function(){	
										$('#myform').form('submit', {    
										    url:'${ctx}/business/projectPause/bizmanager/projectRevoke?pauseCategory='+category,
										    onSubmit: function(){ 											    										
										    if (!$('#myform').form('validate')) {
										   top.$.messager.alert('提示信息','验证没有通过,不能提交表单！','info');   	
									
												return false; //当表单验证不通过的时候 必须要return false 
											   }
										    },   
										    success:function(data){ 	 
										       if(data=="saveSuccess"){	
										top.$.messager.alert('提示信息','项目撤销成功！','info',function(){
											$('#projectPause').dialog('close');
											$('#listProjectsTable').datagrid('reload');});   										
												}
										       else if(data=="reasonnull"){
										    	   top.$.messager.alert('提示信息','撤销原因不为空！','info');  
										    	}else {
												top.$.messager.alert('提示信息','项目撤销失败！','info');   			
												}
										    }    
										        
		                              });  
										}
									
									}
								,
								{
									text:'取消',
									iconCls:'icon-cancel',
									handler:function(){
										$('#projectPause').dialog('close');
								}}
								
								],
			    
							});
				 		$('#projectPause').dialog("center");

			 }	
			
		 //项目重启（竞价）
	        function projectRestoreJ(id){
	     	   $('#projectPause').dialog({
			 			title:"项目重启",  
					    iconCls:'icon-view',
					    width: '600',    
					    height:'225',    
					    closed: false,    
					    inline : true,
					    cache: false,    
				        href: "${ctx}/business/projectPause/leader/toRestartPageJ?projectId="+id,
					    modal: true,
						extractor : function(data){
							if($.trim(data) == "unLogin"){
								var msn = ''||i18n[''];
								msn = msn||i18n[data];
								if(msn != undefined){
									top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
									return '';
								}
							}
							return data;
						   },
						   buttons : [
						        {text:'提交',
								iconCls:'icon-ok',
								handler:function(){	
									
									//加载数据loading
									loading();
									
									$('#myform').form('submit', {    
									    url:'${ctx}/business/projectPause/leader/projectRestoreJ?result=3&pauseCategory=0',
									    onSubmit: function(){ 											    										
									    if (!$('#myform').form('validate')) {
									 //  top.$.messager.alert('提示','选择时间有误,请重新选择!','info');   		
									  		 top.$('#secondtLevelDialog').dialog('close');//关闭加载数据
											return false; //当表单验证不通过的时候 必须要return false 
										   }
									    },   
									    success:function(data){
									       if(data=="saveSuccess"){	
									    	   top.$('#secondtLevelDialog').dialog('close');//关闭加载数据
									    	   $.messager.alert('提示信息','项目重启成功！','info',function(){
									    		   top.$('#secondtLevelDialog').dialog('close');//关闭加载数据
									    		   window.location.reload();
									    		   }); 
									       }else if(data=="saveUnsuccess"){
									    	   top.$('#secondtLevelDialog').dialog('close');//关闭加载数据
											   $.messager.alert('提示信息','开标时间维护推送至银行失败，请联系系统管理员！','error');
									       }
											 else{
												 top.$('#secondtLevelDialog').dialog('close');//关闭加载数据
											   $.messager.alert('提示信息','新投标时间需晚于旧投标时间和当前时间！','error');
											}
									    }    
	                          });  
									}
								
								}
							,
							{
								text:'取消',
								iconCls:'icon-cancel',
								handler:function(){
									$('#projectPause').dialog('close');
							}}
							
							],
		    
						});
			 		$('#projectPause').dialog("center");
		       
			 }
		 
	        //项目重启(中标)
	        function projectRestoreZ(id){
	     	   $('#projectPause').dialog({
			 			title:"项目重启",  
					    iconCls:'icon-view',
					    width: '600',    
					    height:'225',    
					    closed: false,    
					    inline : true,
					    cache: false,    
				        href: "${ctx}/business/projectPause/leader/toRestartPageZ?projectId="+id,
					    modal: true,
						extractor : function(data){
							if($.trim(data) == "unLogin"){
								var msn = ''||i18n[''];
								msn = msn||i18n[data];
								if(msn != undefined){
									top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
									return '';
								}
							}
							return data;
						   },
						   buttons : [
						        {text:'提交',
								iconCls:'icon-ok',
								handler:function(){	
									$('#myform').form('submit', {    
									    url:'${ctx}/business/projectPause/leader/projectRestoreZ?result=3&pauseCategory=1',
									    onSubmit: function(){ 											    										
									    if (!$('#myform').form('validate')) {	
									    top.$.messager.alert('提示信息','验证没有通过,不能提交表单！','error');
										/*	$.messager.show({
												title : '提示信息',
												msg : '验证没有通过,不能提交表单!'
											});*/
											return false; //当表单验证不通过的时候 必须要return false 
										   }
									    },   
									    success:function(data){
									       if(data=="saveSuccess"){	
									    	  top.$.messager.alert('提示信息','项目重启成功！','info',function(){
									    		  window.location.reload();  }); 
									    	  }
											 else{
											   $.messager.alert('提示信息','新公示时间需晚于旧公示时间和当前时间！','info');
											}
									     // $('#projectPause').dialog('close');
									     
									    }    
	                          });  
									}
								
								}
							,
							{
								text:'取消',
								iconCls:'icon-cancel',
								handler:function(){
									$('#projectPause').dialog('close');
							}}
							
							],
		    
						});
			 		$('#projectPause').dialog("center");
		       
			 }
		 
			 
			
			 //流标
	        function projectFlow(id,category){
	        	   $('#projectPause').dialog({
			 			title:"项目流标",  
					    iconCls:'icon-view',
					    width: '600',    
					    height:'225',    
					    closed: false,    
					    inline : true,
					    cache: false,    
				        href: "${ctx}/business/projectPause/bizmanager/projectFlowPage?projectId="+id,
					    modal: true,
						extractor : function(data){
							if($.trim(data) == "unLogin"){
								var msn = ''||i18n[''];
								msn = msn||i18n[data];
								if(msn != undefined){
									top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
									return '';
								}
							}
							return data;
						   },
						   buttons : [
						        {text:'提交',
								iconCls:'icon-ok',
								handler:function(){	
									$('#myform').form('submit', {    
									    url:'${ctx}/business/projectPause/bizmanager/projectFlow?pauseCategory='+category,
									    onSubmit: function(){ 											    										
									    if (!$('#myform').form('validate')) {
									     top.$.messager.alert('提示信息','验证没有通过,不能提交表单！','error');
											/*$.messager.show({
												title : '提示信息',
												msg : '验证没有通过,不能提交表单!'
											});*/
											return false; //当表单验证不通过的时候 必须要return false 
										   }
									    },   
									    success:function(data){
									       if(data=="saveSuccess"){	
									    top.$.messager.alert('提示信息','流标操作成功！！','info');
									     
									     /*  $.messager.show({
												title : '提示信息',
												msg : '流标操作成功！'
											  });  */
											} else{
										top.$.messager.alert('提示信息','流标操作失败！','info');		
											  /*  $.messager.show({
												title : '提示信息',
												msg : '流标操作失败！'
											  });  */
											}
									      $('#projectPause').dialog('close');
									      $(function(){
	                                          setTimeout(function () { window.location.reload();},1000);
	                                         });   
									    }    
	                             });  
									}
								
								}
							,
							{
								text:'取消',
								iconCls:'icon-cancel',
								handler:function(){
									$('#projectPause').dialog('close');
							}}
							
							],
		    
						});
			 		$('#projectPause').dialog("center");
		       
			 }
	        
	         //变更公告
	   		 function editPublish(id){
	   			 top.$('#firstLevelDialog').dialog({
	   		 			title:"变更公告",  
	   				    iconCls:'icon-view',
	   				    width: '900',    
	   				    height:'500',    
	   				    closed: false,    
	   				    inline : true,
	   				    cache: false,    
	   				    href: "${ctx}/business/projectmanage/leader/editPublish?projectId="+id,
	   				    modal: true,
	   				    close: afterClosed,
	   					extractor : function(data){
	   						if($.trim(data) == "unLogin"){
	   							var msn = ''||i18n[''];
	   							msn = msn||i18n[data];
	   							if(msn != undefined){
	   								top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
	   								return '';
	   							}
	   						}
	   						return data;
	   					},
	   					buttons :
	   						[{text:'提交',
	   							iconCls:'icon-ok',
	   							handler:function(){
	   								if(top.$('#addContentDataForm').form('validate')){//表单校验是否通过
	   									//获取富文本中的文字									
	   									top.$('#contentMsg').val(top.getEditorHTMLContents());
	   									$.ajax({
	   										type: "post",
	   										url:  "${ctx}/business/webcontent/save",
	   										data:top.$('#addContentDataForm').serialize(),
	   										success: function(data,res){
	   											var result = $.trim(res.responseText);
	   											if(result == "unLogin"){
	   												var msn = ''||i18n[''];
	   												msn = msn||i18n[result];
	   												if(msn != undefined){
	   													top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
	   													return ;
	   												}
	   											}
	   											top.$.messager.alert("提示",'操作成功!','info',function(){
	   												$('#listProjectsTable').datagrid('reload');
	   											});
	   											
	   										},
	   										error: function(res){
	   											$.messager.alert('提示',i18n.requestError,'error');
	   										}
	   									});
	   									top.$('#firstLevelDialog').dialog('close');
	   								}
	   							}
	   						},{
	   							text:'取消',
	   							iconCls:'icon-cancel',
	   							handler:function(){
	   								top.$('#firstLevelDialog').dialog('close');
	   							}}],
	   							onClose : function(){// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
	   								top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
	   								afterClosed();
	   							}
	   			});
	   		 		top.$('#firstLevelDialog').dialog("center");
	   		 }
	         
	         
	   		//加载数据loading
			 function loading(){
					top.$('#secondtLevelDialog').dialog({
					closable: false,
				    title:'数据加载',
				    width: '300',    
				    height: '180',    
				    closed: false,    
				    inline : true,
				    cache: false,    
				    href: "${ctx}/commons/js/loading/loading.html",
				    modal: true,
					extractor : function(data){
						if($.trim(data) == "unLogin"){
							var msn = ''||i18n[''];
							msn = msn||i18n[data];
							if(msn != undefined){
								top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
								return '';
							}
						}
						return data;
					}
					});
					top.$('#secondtLevelDialog').dialog("center");
				}
	   		
	   		/**
	   		* 评标之后补录评标过程的资料
	   		*/
	   		function makeupFile(id){
	   			top.$('#firstLevelDialog').dialog({
   		 			title:"补录资料",  
   				    iconCls:'icon-view',
   				    width: '900',    
   				    height:'500',    
   				    closed: false,    
   				    inline : true,
   				    cache: false,    
   				    href: "${ctx}/business/projectmanage/leader/makeFileInput?projectId="+id,
	   				modal: true,
	 			    close: afterClosed,
	 				extractor : function(data){
	 					if($.trim(data) == "unLogin"){
	 						var msn = ''||i18n[''];
	 						msn = msn||i18n[data];
	 						if(msn != undefined){
	 							top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
	 							return '';
	 						}
	 					}
	 					return data;
	 				},
	 			    buttons : [{
	 						text:'提交',
	 						iconCls:'icon-ok',
	 						handler:function(){
	 							if(top.$('#addDataForm').form('validate')){//表单校验是否通过
	 								//alert("提交按钮操作");
	 								$.ajax({
	 									type : "post",
	 									url : "${ctx}/business/projectmanage/leader/doSubmitmakeFile?r="+new Date().getTime(),
	 									data : top.$("#addDataForm").serialize(),
	 									success : function(data){
	 										if(data=="success"){
	 											//top.$(".upload").uploadify('destroy');//销毁文件上传对象....
	 												top.$.messager.alert("提示",'提交成功','info',function(){
	 													$('#listProjectsTable').datagrid('reload');
	 													top.$('#firstLevelDialog').dialog('close');
	 												});
	 										}
	 										else{
	 											top.$.messager.alert("提示",'提交失败!',"error");
	 										}
	 									},
	 								error : function(data){
	 										top.$.messager.alert("提示",'提交失败!',"error");
	 								}
	 								});
	 							}
	 							
	 						}},
	 						{
	 							text:'取消',
	 							iconCls:'icon-cancel',
	 							handler:function(){
	 								top.$('#firstLevelDialog').dialog('close');
	 							}}],
	 						onClose : function(){// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
	 							top.$(".uploadify").each(function() {
	 								var uploadId=$(this).parent().parent().find(".uploadify").attr("id");
	 								top.$("#"+uploadId).uploadify('destroy');//销毁文件上传对象....
	 							});
	 							afterClosed();
	 						}
	 				});
	 	 		top.$('#firstLevelDialog').dialog("center");
	   		}
	   		
	 /*录入专家信息*/
			 function professorEdit(id){   
			    top.$('#firstLevelDialog').dialog({
				 			title:"专家信息",  
						    iconCls:'icon-view',
						    width: '1015',    
						    height:'425',    
						    closed: false,    
						    inline : true,
						    cache: false,    
						    href: "${ctx}/business/professor/toProfessorListPage?projectId="+id,
						    modal: true,
						    close: afterClosed,
							extractor : function(data){
								if($.trim(data) == "unLogin"){
									var msn = ''||i18n[''];
									msn = msn||i18n[data];
									if(msn != undefined){
										top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
										return '';
									}
								}
								return data;
							   },
							   buttons : [
							        {text:'关闭',
									iconCls:'icon-ok',
									handler:function(){	
										 top.$('#firstLevelDialog').dialog('close');
										 $('#listProjectsTable').datagrid('reload');
									}
									
									}
								,
								{
									text:'取消',
									iconCls:'icon-cancel',
									handler:function(){
										top.$('#firstLevelDialog').dialog('close');
								}}],
			    
							});
			    
			 }
	 
			//===============================================================
			/**打印中标通知书**/
			function printWinbidAlert(id){
				window.open("${ctx}/business/projectmanage/bidder/winbidAlertPrint?projectId="+id);
			}
	         
</script>